package com.yuan.yblog.crud.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yuan.yblog.crud.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


@Mapper
public interface UserMapper extends BaseMapper<User> {

    /**
    * 查询当前表是否存在某个字段（列）。若存在，返回数目；若不存在，返回0。
    * @param field 字段名
    */
    @Select("select count(*) from information_schema.columns where table_schema = 'yblog' and table_name = 'user' and column_name = #{field};")
    int existsColumn( @Param("field") String field);

}
